%This function creates a new folder in the path specified by the user
%Created by Ricardo Mejia-Alvarez. Urbana, IL. 03/03/08

%modified:  01/28/2010

function [fol,varargout] = newfolder(folData,varargin)

%these lines identify where to cut the string 'folData' to get the path in
%which the results are going to be stored
if ispc == 1
    slash(1:length(folData)) = '\';
else
    slash(1:length(folData)) = '/';
end

folcell = find(folData(1:length(folData)-1) - slash(1:length(folData)-1) == 0, 1, 'last');

%these lines create the path in which the results are going to be stored
fol = folData(1:folcell);   %data and results are under this path

varargout = varargin;

for k = 1 : length(varargin)
    name = char(varargin(k));
    name = strcat(fol,name);
    mkdir(name);
    varargout(k) = {name};
end



end